package com.mercury.tests;

import org.hibernate.*;

import com.mercury.beans.*;

public class Test8 {

	public static void main(String[] args) {
		Session session = HibernateUtil.currentSession();
			
			Transaction tx1 = session.beginTransaction();
			Trader trader1 = new Trader("peter");
			Login login1 = new Login("peter","admin",trader1);
			session.save(login1);
			tx1.commit();
			
			Transaction tx2 = session.beginTransaction();
			Trader trader2 = new Trader("carson");
			Login login2 = new Login("carson","admin",trader2);
			trader2.setLogin(login2);
			session.save(trader2);
			tx2.commit();
			
			HibernateUtil.closeSession();
		}
}
